Skip to content

fix(CompositeDevice): Release axis direction keys when crossing center - #814

Merged
pastaq merged 1 commit into
ShadowBlip:mainfrom
Nevon:fix/axis-direction-key-release
Nov 20, 2026
Merged

pastaq merged 1 commit into
ShadowBlip:mainfrom
Nevon:fix/axis-direction-key-release

Conversation

@Nevon

@Nevon Nevon commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #813.

Axis-to-button mappings only matched events on their own side of center, so if the stick crossed center in a single report, the old direction never got released.

Now axis-to-button mappings get translated on both sides of center, so they can send the release. Some sources (like evdev) report X and Y separately, so an event without the mapped axis now translates to InputValue::None instead of a release. Otherwise a Y-only event would end up releasing a held left, for example.

That means a lot of extra releases, so handle_event now uses each translated event's own pressed state instead of the source's (always true for a Vector2). That way is_new_active_event drops releases for keys that aren't held. If one direction releases a key another one presses in the same event, the release is dropped too.

Chords are now limited to events from the same mapping. Otherwise left -> right counts as a chord, which would delay the right press, which in turn means that the next release can overtake it.

I tested this using the same method I explained in the issue (watching the virtual keyboard with evtest), as well as with a game where the previous behavior would lead to broken movement due to stuck directional keys.

Axis direction mappings only matched events on their own side of center,
so a key mapped to a stick direction stayed held when the stick crossed
center within a single report. Button targets of these mappings are now
translated on both sides of center so they get released, relying on the
existing active input tracking to drop redundant releases.

Fixes ShadowBlip#813

Assisted-by: LLM
@pastaq
pastaq merged commit 3ccecf3 into ShadowBlip:main Nov 20, 2026
3 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.85.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stick direction mapped to a key stays pressed after the stick crosses center

2 participants